package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.CheckGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CheckGroupMapper extends BaseMapper<CheckGroup> {
    //录入检查项，检查组中间表
    @Insert("insert into t_checkgroup_checkitem values (#{gid},#{checkitemId})")
    void addCheckGroupIdAndCheckItemId(@Param("gid")Integer gid, @Param("checkitemId")Integer checkitemId);

    //查询当前，检查组所对应的检查项的id集合
    @Select("select CHECKITEM_ID from t_checkgroup_checkitem where CHECKGROUP_ID = #{gid}")
    List<Integer> findCheckItemInfoByGroupId(@Param("gid")int gid);

    //根据检查组id，物理删除中间表gg
    @Delete("delete from t_checkgroup_checkitem where CHECKGROUP_ID = #{id}")
    void deleteCheckItemInfoByGroupId(@Param("id") Integer id);
}
